﻿#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<set>
#include<map>
#include<vector>
using namespace std;


void test1()
{
	vector<int> v1 = { 1,4,5,3,67,9,3,31 };
	set<int> s1(v1.begin(), v1.end());
}

void test2()
{
	set<int> s1;
	auto it = s1.insert(1);
	cout << *it.first << endl;
	cout << it.second<< endl;
	cout <<typeid(it).name()<< endl;
}
void test3()
{
	// 相⽐set不同的是，multiset是排序，但是不去重 
	multiset<int> s = { 4,2,7,2,4,8,4,5,4,9 };
	auto it = s.begin();
	while (it != s.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;

	// 相⽐set不同的是，x可能会存在多个，find查找中序的第⼀个 
	int x;
	cin >> x;
	auto pos = s.find(x);
	while (pos != s.end() && *pos == x)
	{
		cout << *pos << " ";
		++pos;
	}
	cout << endl;
	// 相⽐set不同的是，count会返回x的实际个数 
	cout << s.count(x) << endl;
	// 相⽐set不同的是，erase给值时会删除所有的x 
	s.erase(x);
	for (auto e : s)
	{
		cout << e << " ";
	}
	cout << endl;
}
void test3()
{
	/*map<string , string> m;
	m.insert(pair<string, string>("left", "左边"));*/
	map<string, string> m;
	m.insert(make_pair("left", "左边"));
}
int main()
{
	test2();
	return 0;
}
